#pragma once

#include <QObject>
#include <QTcpSocket>
#include <QTcpServer>
#include <QUdpSocket>
#include <QNetworkDatagram>
#include <QJsonDocument>
#include <QJsonObject>
#include <QtCore/QMap>
#include <QTextStream>
#include <QCoreApplication>

class StkWebClient : public QObject
{
	Q_OBJECT

public:
	StkWebClient(QObject *parent = 0);
	~StkWebClient();
	void startconnect_tcp();
	bool send_tcp(std::string ack, bool testgn = false);

	void startconnect_udp();
	bool send_udp(std::string ack, bool continuerun = false);

	void getTargetIP_Str(std::string& ip_str);
	bool getNetState();
	void break_rec();

	void QtSleep(int ms);

public:
	QTcpSocket* myTCPSocketClient;
	QUdpSocket* myUDPSocketClient;

	int LocalPORT; 
	int TargetPORT;
	QHostAddress TargetIP;

	bool tcp_build;
	bool udp_build;

	QByteArray data;

private:
	QHostAddress LocalIP = QHostAddress::Any;

	bool break_run = false;

public slots:
	void TCP_show();
	void UDP_show();

signals:
	void DataRecSingal();
};
